package top.mayyd.customerdemo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.mayyd.customerdemo.service.UserService;
import top.mayyd.productservice.domain.User;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/{id}")
    public User show(@PathVariable("id") Long id) {
        return userService.queryUserById(id);
    }

    @RequestMapping("")
    public List<User> index() {
        List<Long> ids = Arrays.asList(1L, 2L,3L,4L,5L,6L,7L,8L);
        return userService.queryUsersByIds(ids);
    }
}
